<%@ include file="/public/include.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<link type="text/css" rel="stylesheet" href="styles/pub/default.css">
	<script type="text/javascript" language="JavaScript" src="scripts/pub/jquery.js"></script>
	<script type="text/javascript" language="JavaScript" src="scripts/pub/common.js"></script>
	<script type="text/javascript" language="JavaScript" src="scripts/biz/clear.js"></script>
</head>
<body onload="loadSelectOption();">
<c:set value="${map.decl}" var="decl"/>
<div class="main" align="center">
	<table style="width:100%;" align="center">
		<tr>
			<td>
				<table>
					<caption>
						企业核销
					</caption>
					<tr><td>
						<table  class="bean" style="width:70%;" align="center">
							<tr class="size">
							  <td width="10%"></td>
							  <td></td>
							  <td width="10%"></td>
							  <td width="20%"></td>
							  <td width="10%"></td>
							  <td width="20%"></td>
							</tr>
							<tr>
							  <td class="formLabel" >报检号</td>
							  <td class="formValue">${decl.declNo}</td>
							  <td class="formLabel" >备案号</td>
							  <td class="formValue"></td>
							  <td class="formLabel">备案号含义</td>
							  <td class="formValue">${decl.applyCode}</td>
							</tr>
							<tr>
							  <td class="formLabel" >报检单位</td>
							  <td class="formValue">${decl.entName}</td>
							  <td class="formLabel" >单位注册号</td>
							  <td class="formValue">${decl.declRegNo}</td>
							  <td class="formLabel" >报检日期</td>
							  <td class="formValue"><fmt:formatDate value="${decl.declDate}"  pattern="yyyy-MM-dd"/></td>
							</tr>
						</table>
					</td></tr>
				</table>
			</td>
		</tr>
		
		<tr>
	      <td align="center">
	        <table class="list">
				<caption>
					货物核销清单
				</caption>
				<tr class="title">
				  <td width="5%">序号</td>
				  <td width="10%">流程状态</td>
				  <td>货物名</td>
				  <td width="14%">数量/重量</td>
				  <td width="10%">备案号</td>
				  <td width="14%">HS编码</td>
				  <td width="8%">监管类别</td>
				</tr>
				<%-- 未核销货物 --%>
				<c:forEach items="${map.noClearlist}" varStatus="stat" var="goods">
					<c:set value="${goods.goodsClearItem}" var="clear" />
					<form id="clearForm${goods.id}" action="EntGoodsClear.do" method="post">
			        <tr style="cursor:pointer;" title="点击打开详细列表" onclick="switchDisplay('r${goods.id}')" >
						<td>${stat.count}<c:set var="goodsSeq" value="${stat.count}" /></td>
						<td><mytag:c2s type="clearFlag" key="${goods.goodsClearItem.clearFlag}"/></td>
						<td>${goods.goodsCname}</td>
						<td>${goods.qty}${goods.qtyUnitName}/${goods.weight}${goods.weightUnitCname}</td>
						<td>${decl.applyCode}</td>
						<td>${goods.hsCode}</td>
						<td><span id="inspMonitorCond${goods.id}">${goods.inspMonitorCond}</span></td>
			        </tr>
			        <tr class="wrapElement" id="r${goods.id}" style="background-color:#FFFFB5;">
			        	<td colspan="8">
			        		<table class="bean2" id="goods${goods.id}">
			        			<tr>
									<td width="7%" class="formLabel" >放弃</td>
									<td width="10%" class="formValue"><input type="text" name="giveupCount" value="${clear.giveupCount}" style="width:100%;" id="giveupCount${goods.id}"></td>
									<td width="7%" class="formLabel" >赠送</td>
									<td width="10%" class="formValue"><input type="text" name="largessCount" value="${clear.largessCount}" style="width:100%;" id="largessCount${goods.id}"></td>
									<td width="7%" class="formLabel" >消耗</td>
									<td width="11%" class="formValue"><input type="text" name="consumeCount" value="${clear.consumeCount}" style="width:100%;" id="consumeCount${goods.id}"></td>
									<td width="7%" class="formLabel" >销毁</td>
									<td width="10%" class="formValue"><input type="text" name="destroyCount" value="${clear.destroyCount}" style="width:100%;" id="destroyCount${goods.id}"></td>
									<td width="7%" class="formLabel" >转运</td>
									<td width="9%" class="formValue"><input type="text" name="transportCount" value="${clear.transportCount}" style="width:100%;" id="transportCount${goods.id}"></td>
									<td width="7%" class="formLabel" >留购</td>
									<td  class="formValue"><input type="text" name="buyCount" value="${clear.buyCount}" style="width:100%;" id="buyCount${goods.id}"></td>
								</tr>
								<tr>
									<td class="formLabel" >回运</td>
									<td class="formValue"><input type="text" name="returnCount" value="${clear.returnCount}" style="width:100%;" id="returnCount${goods.id}"></td>
									<td class="formLabel" >罚没</td>
									<td class="formValue"><input type="text" name="punishCount" value="${clear.punishCount}" style="width:100%;" id="punishCount${goods.id}"></td>
									<td class="formLabel" >遗失</td>
									<td class="formValue"><input type="text" name="loseCount" value="${clear.loseCount}" style="width:100%;" id="loseCount${goods.id}"></td>
									<td class="formLabel" >其他</td>
									<td class="formValue"><input type="text" name="otherCount" value="${clear.otherCount}" style="width:100%;" id="otherCount${goods.id}"></td>
									<td class="formLabel" >核销选择</td>
									<td class="formValue">
										<select style="width:100%;" tabindex="${clear.clearOption}" name="clearOption" id="clearOption${goods.id}">
											<option value="-1">请选择</option>
											<option value="1" alt="${goods.qty}">数量</option>
											<option value="2" alt="${goods.weight}">重量</option>
										</select>
										<input type="hidden" id="qty${goods.id}" value="${goods.qty}">
										<input type="hidden" id="weight${goods.id}" value="${goods.weight}">
									</td>
									<td class="formLabel" >差额</td>
									<td class="formValue">
										<span id="balanceSpan${goods.id}">${clear.balance}</span>
										<input id="balance${goods.id}" type="hidden" name="balance" value="">
									</td>
								</tr>
								<tr>
									<td class="formLabel"  colspan="1">留购/出境<br>报关单号</td>
									<td class="formValue" colspan="2">
										<textarea rows="2" cols="18" id="declareNo${goods.id}" name="declareNo" style="width:100%;">${clear.declareNo}</textarea>
									</td>
									<td class="formLabel" >留购/出境<br>通关单号</td>
									<td class="formValue" colspan="2">
										<div id="pbt${goods.id}">
											<c:forEach items="${clear.passageBills}" var="passage"><div>${passage.passageNo}&nbsp;<a title="删除" onclick="deletePBItem(${goods.id},${passage.passageNo});" style="cursor: pointer;">&times;</a></div></c:forEach>
										</div>
										<div>
											<input type="text" maxlength="15" value="" id="pbs${goods.id}">
											<a href="#" onclick="insertPassageBillValue(${goods.id})">添加</a>
											<input type="hidden"  id="passageNo${goods.id}" name="passageNo" value="<c:forEach items="${clear.passageBills}" var="passage">${passage.passageNo};</c:forEach>">
										</div>
									</td>
									<td class="formLabel" >企业备注</td>
									<td class="formValue" colspan="2">
										<textarea rows="2" cols="16" id="entOpinion${goods.id}" name="entOpinion" style="width:100%;">${clear.entOpinion}</textarea>
									</td>
									<td class="formLabel" >CIQ意见</td>
									<td class="formValue" colspan="2">${clear.auditOpinion}</td>
								</tr>
								
								<tr><td  class="formLabel" colspan="12" style="text-align: center;height:35px;">
										<input type="hidden" name="declId" value="${decl.id}" > 
										<input type="hidden" name="goodsId" value="${goods.id}" > 
										<input type="hidden" name="declNo" value="${decl.declNo}" > 
										<input type="hidden" name="goodsNo" value="${goods.goodsNo}" >
										<input type="hidden" name="qty" value="${goods.qty}" >
										<input type="hidden" name="weight" value="${goods.weight}" >
										<input type="hidden" id="clearFlag${goods.id}" name="clearFlag" value="" >
										<input type="submit"  value="暂存" id="save${goods.id}" onclick="return entSaveGoodsClear(${goods.id})">&nbsp;&nbsp;
										<input type="submit"  value="强制核销" id="force${goods.id}" onclick='return entSubmitGoodsClear(true,${goods.id},"${goods.goodsCname}");' >&nbsp;&nbsp;
										<input type="submit"  value="核销" id="pass${goods.id}" onclick='return entSubmitGoodsClear(false,${goods.id},"${goods.goodsCname}");' >
								</td></tr>
			        		</table>
			        	</td>
			        </tr>
			        </form>
				</c:forEach>
				
				<%-- 已核销货物	 --%>
				<c:forEach items="${map.alreadyClearlist}" varStatus="stat" var="goods">
					<c:set value="${goods.goodsClearItem}" var="clear" />
					<tr style="cursor:pointer;" title="点击打开详细列表" onclick="switchDisplay('r${goods.id}')">
						<td>${stat.count+goodsSeq}</td>
						<td><mytag:c2s type="clearFlag" key="${goods.goodsClearItem.clearFlag}"/></td>
						<td>${goods.goodsCname}</td>
						<td>${goods.qty}${goods.qtyUnitName}/${goods.weight}${goods.weightUnitCname}</td>
						<td>${decl.applyCode}</td>
						<td>${goods.hsCode}</td>
						<td>${goods.inspMonitorCond}</td>
			        </tr>
			        <tr class="wrapElement" id="r${goods.id}" style="background-color:#FFFFB5;">
			        	<td colspan="8">
			        		<table class="bean2" id="goods${goods.id}">
								<tr style="text-align:left;background-color:#EBFFEB;">
									<td width="5%" class="formLabel" >放弃</td>
									<td width="5%" class="formValue">${clear.giveupCount}</td>
									<td width="5%" class="formLabel" >赠送</td>
									<td width="5%" class="formValue">${clear.largessCount}</td>
									<td width="5%" class="formLabel" >消耗</td>
									<td width="5%" class="formValue">${clear.consumeCount}</td>
									<td width="5%" class="formLabel" >销毁</td>
									<td width="5%" class="formValue">${clear.destroyCount}</td>
									<td width="5%" class="formLabel" >转运</td>
									<td width="5%" class="formValue">${clear.transportCount}</td>
									<td width="5%" class="formLabel" >留购</td>
									<td width="5%" class="formValue">${clear.buyCount}</td>
									<td width="5%" class="formLabel" >回运</td>
									<td width="5%" class="formValue">${clear.returnCount}</td>
									<td width="5%" class="formLabel" >罚没</td>
									<td width="5%" class="formValue">${clear.punishCount}</td>
									<td width="5%" class="formLabel" >遗失</td>
									<td width="5%" class="formValue">${clear.loseCount}</td>
									<td width="5%" class="formLabel" >其他</td>
									<td width="5%" class="formValue">${clear.otherCount}</td>
								</tr>
								<tr style="text-align:left;background-color:#EBFFEB;">
									<td class="formLabel" >差额</td>
									<td class="formValue"><span>${clear.balance}</span></td>
									<td class="formLabel" >核销<br>选择</td>
									<td class="formValue"><mytag:c2s key="${clear.clearOption}" type="clearOption"/></td>
									<td colspan="1" class="formLabel" >报关<br>单号</td>
									<td class="formValue" colspan="3">${clear.declareNo}</td>
									<td colspan="1" class="formLabel" >通关<br>单号</td>
									<td class="formValue" colspan="3">
										<c:forEach items="${clear.passageBills}" var="passage">
											<span style="padding-right:8px;">${passage.passageNo}</span>
										</c:forEach>
									</td>
									<td class="formLabel" >企业<br>备注</td>
									<td class="formValue" colspan="3">${clear.entOpinion}</td>
									<td class="formLabel" >CIQ<br>意见</td>
									<td class="formValue" colspan="3">${clear.auditOpinion}</td>
								</tr>
			        		</table>
			        	</td>
			        </tr>
				</c:forEach>
	        </table>
	      </td>
	    </tr>
		
		
		<tr class="button">
		  <td align="center">
		  	<div>
			    <input type="button" value=" 返回 " onClick="window.history.back();">
		  	</div>
		   </td>
		</tr>
	</table>
</div>
</body>
</html>